package com.oa.office.biz;

import java.util.Date;
import java.util.List;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;

import com.oa.office.dao.HeadRoutingMapper;
import com.oa.office.entity.HeadRoutingWithBLOBs;
import com.oa.office.util.DateUtil;

@Service
public class HeadRoutingBiz {
	@Resource
	private HeadRoutingMapper headRoutingDao;
	
	public List<HeadRoutingWithBLOBs> selectByWeek(String spar)throws Exception{
		
		return headRoutingDao.selectByWeek(spar);
	}
	public HeadRoutingWithBLOBs selectByDay(String day)throws Exception{
		return headRoutingDao.selectByDay(day);
	}
	
	public int insertSelective(HeadRoutingWithBLOBs record,String time)throws Exception{
		Date day =DateUtil.StringToDatetime(time);
		Date createTime = new Date();
		record.setDay(day);
		record.setCreateTime(createTime);
		//存入时变更状态，代表没有审批
		record.setState(2);
		return headRoutingDao.insertSelective(record);
	}
	
}
